#include<bits/stdc++.h>
using namespace std;
stack<char>s;
int main(){
	freopen("bracket.in" , "r" , stdin);
	freopen("bracket.out" , "w" , stdout);
	string f;
	getline(cin , f);
	for(int i = 0 ; i < f.length() ; i++){
		if(f[i] == '('){
			s.push(f[i]);
		}
		if(f[i] == ')'){
			if(s.empty()){
				cout << "NO" << endl;
				return 0;
			}
			s.pop();
		}
		if(f[i] == '@'){
			if(s.empty()){
				cout << "YES" << endl;
				return 0;
			}
			cout << "NO" << endl;
		}
	}
	return 0;
}
